package com.souchisouwan.util;

import java.io.IOException;
import java.util.Map;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;

/**
 * http帮助类
 * @author Administrator
 *
 */
public class HttpUtil {
	private static HttpClient client = new DefaultHttpClient();
	/**
	 * post请求
	 * @param url 请求地址
	 * @param param 参数
	 * @return
	 */
	public static String httpPost(String url,Map<String,String> param){
		return null;
	}
	
	/**
	 * post请求
	 * @param url 请求地址
	 * @return
	 */
	public static String httpPost(String url){
		
		HttpPost post = new HttpPost(url);
		String result = "";
		try {
			HttpResponse res = client.execute(post);
			result = EntityUtils.toString(res.getEntity());
		} catch (ClientProtocolException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return result;
	}
	
	/**
	 * get请求
	 * @param url 请求地址
	 * @return
	 */
	public static String httpGet(String url){
		return null;
	}
	
	/**
	 * get请求
	 * @param url 请求地址
	 * @param param 参数
	 * @return
	 */
	public static String httpGet(String url,Map<String,String> param){
		return null;
	}
	
	/**
	 * https post请求
	 * @param url 请求地址
	 * @param param 参数
	 * @return
	 */
	public static String httpsPost(String url,Map<String,String> param){
		return null;
	}
	
	/**
	 * https post请求
	 * @param url 请求地址
	 * @param param 参数
	 * @return
	 */
	public static String httpsPost(String url){
		return null;
	}
	
	/**
	 * https get请求
	 * @param url
	 * @return
	 */
	public static String httpsGet(String url){
		return null;
	}
}
